package hms.ReservationsModule;

import hms.generic.*;
import hms.ReservationsModule.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/*This class displays the Rewards sub-module.  This module allows user to perform the following:
 * -add/delete/manage all rewards
 * -create/delete/manage rewards accounts for any and all guests within the DB
 * 
 * @author Edgar Onukwugha*/

public class RewardsView extends AbstractGlobalView{

	//defines components used in sub-module
	protected JPanel memberInfo, rewardsPanel;
	protected JLabel rewardDesc, rewardAmt;
	protected JTable rewardInfo;
	protected JButton rewardManage, acctManage;
	
	protected int memberPoints;
	
	ManageAccountView mav = new ManageAccountView();
	
	//initializes main components used in Rewards sub-module
	//returns JPanel for use in ReservationModule
	public JPanel initRewardsView(){
		//initialize components 
		memberInfo = showMemberInfo();
		rewardsPanel = new JPanel();
		
		rewardManage = new JButton("Manage Rewards");
		acctManage = new JButton("Manage Member Account");
		
		//adds components to JPanel
		rewardsPanel.add(rewardInfo);
		rewardsPanel.add(rewardManage);
		rewardsPanel.add(acctManage);
		
		//returns JPanel
		return rewardsPanel;
	}
	
	/*shows membership information of guest*/
	public JPanel showMemberInfo(){
		return mav.createManageAccountView();
	}

	/*used to populate table with information about member rewards*/
	public void populateTable(JTable rewardInfo){
		//TODO: create table model to dynamically add rows for new rewards
		//creates String and Object arrays for use in JTable
		//creates column names for reward information
		String[] columnNames = {"Reward Description", "Discount Amount"};
		
		//populates table with information
		/*needs to be dynamic when creating information for table
		 * will use DAO objects */
		Object[][] rewardData = {{"", "0%"}};
		
		rewardInfo = new JTable(rewardData, columnNames);
		
		rewardInfo.setPreferredScrollableViewportSize(new Dimension(450, 100));
		rewardInfo.setFillsViewportHeight(true);
	}
	
	@Override
	//sets action events for all components in sub-module
	public void actionPerformed(ActionEvent event) {
		// TODO pass object for selection menu to use with JTable
		
	}

}
